#ifndef __BOX_H__
#define __BOX_H__

#include <vector>

#include "point.h"

namespace verema
{
/**
 * \class Box
 *
 * \brief A box consists of 4 verema::Points
 */
class Box
{
private:
	std::vector<Point> points;

	void sortPoints();

public:
	Box()
	{
        for(int counter = 0; counter < 4; ++counter)
        {
            Point point;
            points.push_back(point);
        }
    }

    Box(Point &p1, Point &p2, Point &p3, Point &p4);
	Box(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);

	Point& point1() { return points.at(0); }
	Point& point2() { return points.at(1); }
	Point& point3() { return points.at(2); }
	Point& point4() { return points.at(3); }

	void point1(int x, int y) { points.at(0).x(x); points.at(0).y(y); /*sortPoints();*/ }
	void point2(int x, int y) { points.at(1).x(x); points.at(1).y(y); /*sortPoints();*/ }
	void point3(int x, int y) { points.at(2).x(x); points.at(2).y(y); /*sortPoints();*/ }
	void point4(int x, int y) { points.at(3).x(x); points.at(3).y(y); /*sortPoints();*/ }

	void point1(const Point &p) { points.at(0).x(p.x()); points.at(0).y(p.y()); }
	void point2(const Point &p) { points.at(1).x(p.x()); points.at(1).y(p.y()); }
	void point3(const Point &p) { points.at(2).x(p.x()); points.at(2).y(p.y()); }
	void point4(const Point &p) { points.at(3).x(p.x()); points.at(3).y(p.y()); }

	~Box()
	{ }
};

} // namespace verema

#endif // __BOX_H__
